package org.femto.math.vis;

import javax.media.opengl.GL;
import org.femto.math.linalg.Matrix4x4;
import org.femto.math.linalg.Vec3;

public class Pan implements Manipulator {

    public Vec3 p0 = new Vec3();
    public Vec3 p1 = new Vec3();
    Matrix4x4 T = new Matrix4x4();
    Matrix4x4 Tincr = new Matrix4x4();
    public double panCoeff = 1;

    public Pan() {
    }

    public void beginDrag(Vec3 p) {
        p1 = p;
    }

    public void drag(Vec3 p) {
        p0 = p1;
        p1 = p;

        Tincr.setTranslation(Vec3.sub(p1, p0));
        T.mulInplace(Tincr);
    }

    public void endDrag(Vec3 p) {
        Tincr.setIdentity();
    }

    public Matrix4x4 getTransform() {
        return T;
    }

    public void render(GL gl) {

    }

    public void move(Vec3 p) {

    }
}
